<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
  <head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta name="keywords" content="scclui框架">
	<meta name="description" content="scclui为轻量级的网站后台管理系统模版。">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />
    <title>首页</title>
	  <script type="text/javascript" src="/HouTaiGuanLiZuiZhong/recycle/Public/common/js/jquery-1.8.2.min.js"></script>
	  <script type="text/javascript">
		  $(function () {
//			  添加型号
			  $('#insertType').click(function () {
				  var type = $("input[name='type']").val();
				  var brand_id = $("input[name='brand_id']").val();
				  var url = $("#hid").val();
				  $.get(url, {type: type, brand_id: brand_id}, function (data) {
					  if (data) {
						  alert(data)
						  window.location.reload()
					  } else {
						  alert('添加失败');
					  }
				  })
			  })
			  //			  删除型号
			  $('.delete_type').click(function(e){
				  e.preventDefault();
				  var url = $('#hid').val();
				  var id = $(this).attr("href");
//				  alert(id)
				  $.get(url,{id:id},function(data){
					  if(data){
						  alert(data)
						  window.location.reload()
					  }else{
						  alert('删除失败')
					  }
				  })
			  })
		  })

	  </script>
  </head>
  
  <body>
	 <b> 当前所有手机型号</b>：
	  <table>
		  <?php if($rs == array()): ?>当前还没有手机型号，您可以点击添加
			  <?php else: ?>
			  <tr>
				  <?php if(is_array($rs)): $i = 0; $__LIST__ = $rs;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><td><?php echo ($data["type"]); ?>&nbsp;&nbsp;</td><?php endforeach; endif; else: echo "" ;endif; ?>
			  </tr><?php endif; ?>
	  </table>
	  <p><b>添加型号：</b></p>
	  <p>
		  输入型号：
		  <input type="text" name="type">
		  <input type="hidden" id="hid" value="<?php echo U('checkType');?>">
	  </p>
	  <p>
		  输入他的父级id：
		  <input type="text" name="brand_id">
		  <button id="insertType">添加</button>
	  </p>
	  <p>
		  <b>请点击要删除的手机型号：</b>
	  <table>
		 <tr>
		  <?php if(is_array($rs)): $i = 0; $__LIST__ = $rs;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><td><a href="<?php echo ($data["id"]); ?>" class="delete_type" style="text-decoration: none"><?php echo ($data["type"]); ?>&nbsp;&nbsp;</a></td><?php endforeach; endif; else: echo "" ;endif; ?>
		 </tr>
	  </table>
	  </p>

  </body>
</html>